#!/usr/bin/env python3
# _*_coding:utf-8 _*_
__author__ = "Gao"

import datetime

import json

class JsonEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o,datetime.datetime):
            return o.strftime("%Y-%m-%d %H:%M:%S")
        elif isinstance(o,datetime.date):
            return o.strftime("%Y-%m-%d")
        else:
            return json.JSONEncoder.default(self,o)
